package com.bawei.monthdemo2207a

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge

import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import com.bawei.monthdemo2207a.month01.local.LocalAppPage
import com.bawei.monthdemo2207a.month01.local.LocalFilePage
import com.bawei.monthdemo2207a.month01.route.RouteConfig
import com.bawei.monthdemo2207a.ui.theme.MonthDemo2207ATheme
import com.bawei.monthdemo2207a.month01.view.MainPage
import com.bawei.monthdemo2207a.month01.view.WelcomePage
import com.bawei.monthdemo2207a.month01.view.XieYiPage
import com.bawei.monthdemo2207a.month02.upload.UploadPage
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContent {

            val navController = rememberNavController()
            
            NavHost(navController = navController, startDestination = com.bawei.monthdemo2207a.month02.route.RouteConfig.MAIN) {
                composable(com.bawei.monthdemo2207a.month02.route.RouteConfig.MAIN) {
                    com.bawei.monthdemo2207a.month02.view.MainPage(navController)
                }
                composable(com.bawei.monthdemo2207a.month02.route.RouteConfig.UPLOAD) {
                    UploadPage()
                }
            }
            
        }
    }

    @Composable
    private fun Month01Nav(
        navController: NavHostController,
        startDestination: String
    ) {
        NavHost(navController = navController, startDestination = startDestination) {
            // 启动页
            composable(RouteConfig.WELCOME) {
                WelcomePage(navController)
            }
            // 协议页面
            composable(RouteConfig.XIE_YI) {
                XieYiPage(navController)
            }

            // 主页面
            composable(RouteConfig.MAIN) {
                MainPage(navController)
            }

            // 本地文件
            composable(RouteConfig.LOCAL_FILE) {
                LocalFilePage(navController)
            }

            // 本地App
            composable(RouteConfig.LOCAL_APP) {
                LocalAppPage(navController)
            }

        }
    }
}
